package io.terminus.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import io.terminus.entity.Employee;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * DAO层 Mybatis Plus Mapper
 *
 * @author Melo
 */
@Repository
public interface EmployeeMapper extends BaseMapper<Employee> {

    /**
     * 自定义SQL查询
     *  注解形式
     *
     * @param wrapper 入参Wrapper
     * @return 查询结果集合
     */
    @Select("SELECT * FROM tbl_employee ${ew.customSqlSegment}")
    List<Employee> selectAll(@Param(Constants.WRAPPER) Wrapper<Employee> wrapper);

    /**
     * 自定义SQL查询
     *  XML形式
     *
     * @param wrapper 入参Wrapper
     * @return 查询结果集合
     */
    List<Employee> selectAllByXml(@Param(Constants.WRAPPER) Wrapper<Employee> wrapper);
}
